home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / intuition / newobjecta.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  3KB  |  120 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: newobjecta.c,v 1.3 1996/10/24 15:51:22 aros Exp $
  4.     $Log: newobjecta.c,v $
  5.     Revision 1.3  1996/10/24 15:51:22  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.2  1996/10/23 16:30:09  aros
  9.     Ooops.. PublicClassList is a MinNode list :-)
  10.  
  11.     Revision 1.1  1996/08/28 17:55:35  digulla
  12.     Proportional gadgets
  13.     BOOPSI
  14.  
  15.  
  16.     Desc:
  17.     Lang: english
  18. */
  19. #define AROS_ALMOST_COMPATIBLE
  20. #include <exec/lists.h>
  21. #include <intuition/classes.h>
  22. #include <clib/exec_protos.h>
  23. #include <clib/alib_protos.h>
  24. #include "intuition_intern.h"
  25.  
  26. /*****************************************************************************
  27.  
  28.     NAME */
  29.     #include <intuition/classusr.h>
  30.     #include <clib/intuition_protos.h>
  31.  
  32.     AROS_LH3(APTR, NewObjectA,
  33.  
  34. /*  SYNOPSIS */
  35.     AROS_LHA(struct IClass  *, classPtr, A0),
  36.     AROS_LHA(UBYTE          *, classID, A1),
  37.     AROS_LHA(struct TagItem *, tagList, A2),
  38.  
  39. /*  LOCATION */
  40.     struct IntuitionBase *, IntuitionBase, 106, Intuition)
  41.  
  42. /*  FUNCTION
  43.     Use this function to create BOOPSI objects (BOOPSI stands for
  44.     "Basic Object Oriented Programming System for Intuition).
  45.  
  46.     You may specify a class either by it's name (if it's a public class)
  47.     or by a pointer to its definition (if it's a private class). If
  48.     classPtr is NULL, classID is used.
  49.  
  50.     INPUTS
  51.     classPtr - Pointer to a private class (or a public class if you
  52.         happen to have a pointer to it)
  53.     classID - Name of a public class
  54.     tagList - Initial attributes. Read the documentation of the class
  55.         carefully to find out which attributes must be specified
  56.         here and which can.
  57.  
  58.     RESULT
  59.     A BOOPSI object which can be manipulated with general functions and
  60.     which must be disposed with DisposeObject() later.
  61.  
  62.     NOTES
  63.     This functions send OM_NEW to the dispatcher of the class.
  64.  
  65.     EXAMPLE
  66.  
  67.     BUGS
  68.  
  69.     SEE ALSO
  70.     DisposeObject(), SetAttrs(), GetAttr(), MakeClass(),
  71.     "Basic Object-Oriented Programming System for Intuition" and
  72.     "boopsi Class Reference" Dokument.
  73.  
  74.     INTERNALS
  75.  
  76.     HISTORY
  77.     29-10-95    digulla automatically created from
  78.                 intuition_lib.fd and clib/intuition_protos.h
  79.  
  80. *****************************************************************************/
  81. {
  82.     AROS_LIBFUNC_INIT
  83.     AROS_LIBBASE_EXT_DECL(struct IntuitionBase *,IntuitionBase)
  84.     Object * object;
  85.     struct _Object carrier;
  86.  
  87.     /* No classPtr ? */
  88.     if (!classPtr)
  89.     {
  90.     /* Search for the class */
  91.     for (classPtr=GetHead(PublicClassList);
  92.         classPtr;
  93.         classPtr=GetSucc(classPtr)
  94.     )
  95.     {
  96.         if (!strcmp (classPtr->cl_ID, classID))
  97.         break;
  98.     }
  99.  
  100.     if (!classPtr)
  101.         return (NULL); /* Nothing found */
  102.     }
  103.  
  104.     /* Put the classPtr in our dummy object */
  105.     carrier.o_Class = classPtr;
  106.  
  107.     /* Try to create a new object */
  108.     if ((object = (Object *) DoMethod (BASEOBJECT(&carrier), OM_NEW,
  109.         tagList, NULL)))
  110.     {
  111.     OCLASS(object) = classPtr;
  112.  
  113.     /* One more object */
  114.     classPtr->cl_ObjectCount ++;
  115.     }
  116.  
  117.     return (object);
  118.     AROS_LIBFUNC_EXIT
  119. } /* NewObjectA */
  120.